package com.cn.shchuangge.projectwork;

import android.content.Intent;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;


/**
 * Created by 赵航 on 2017/6/15.
 */

public class BasicActivity extends AppCompatActivity {


    private long mPressedTime = 0;

    /**
     * 这是专门做跳转界面的在父类BasicActivity中
     *
     * @param clazz   要跳转的界面.class
     * @param isFinsh 是否要让这个界面从任务栈中去除
     */
    public void myStartActivity(Class clazz, boolean isFinsh) {

        startActivity(new Intent(BasicActivity.this, clazz));
        if (isFinsh) {
            finish();
        }

    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {

        //入侵式状态栏，只有5.0以后才能用，并且只能加到R.layout.xxx前面
        if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            Window window = getWindow();
            window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
                    | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
            window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                    | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                    | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
            window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
            window.setStatusBarColor(Color.TRANSPARENT);
            window.setNavigationBarColor(Color.TRANSPARENT);
        }
        super.onCreate(savedInstanceState);


    }


}
